﻿using System.Drawing;

namespace DataLayer
{
    public class ImageUtil
    {

        public static byte[] ImageToByte(Image img)
        {
            ImageConverter converter = new ImageConverter();
            return (byte[])converter.ConvertTo(img, typeof(byte[]));
        }

        public static Image ByteToImage(byte[] data)
        {
            ImageConverter converter = new ImageConverter();
            Bitmap bmp = (Bitmap)converter.ConvertFrom(data);
            return bmp;
        }
    }
}
